﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="dialog_print.aspx.cs" Inherits="SF.Ucenter.admin.dialog.dialog_print" %>

<%@ Import Namespace="SF.Common" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>打印订单窗口</title>
    <script type="text/javascript" charset="utf-8" src="../../scripts/jquery/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../scripts/artdialog/dialog-plus-min.js"></script>
    <script type="text/javascript" charset="utf-8" src="../js/common.js"></script>
    <script type="text/javascript">
        var api = top.dialog.get(window); //获取父窗体对象
        //页面加载完成执行
        $(function () {
            //设置按钮及事件
            api.button([{
                value: '确认打印',
                callback: function a() {
                    $.get("../../tools/goods_ajax.ashx", { "action": "upadte_express", "id": $("#orderId").val() }, function () {
                    });
                    printWin();
                },
                autofocus: true
            }, {
                value: '取消',
                callback: function () {}
            }]);
        });
        //打印方法
        function printWin() {
            var oWin = window.open("", "_blank");
            oWin.document.write(document.getElementById("content").innerHTML);
            oWin.focus();
            oWin.document.close();
            oWin.print();
            oWin.close();
            return false;
        }
    </script>
</head>

<body style="margin: 0;">
    <form id="form1" runat="server">
        <div id="content">
            <table width="800" border="0" align="center" cellpadding="3" cellspacing="0" style="font-size: 12px; font-family: '微软雅黑'; background: #fff;">
                <tr>
                    <td width="346" height="50" style="font-size: 20px;">商品订单</td>
                    <asp:HiddenField ID="orderId" runat="server" />
                    <td width="216">订单号：<%=model.orderNum%><br />
                        日&nbsp;&nbsp; 期：<%=Convert.ToDateTime(model.addTime).ToString("yyyy-MM-dd")%></td>
                    <td width="220">操&nbsp; 作 人：<%=adminModel.real_name%><br />
                        打印时间：<%=DateTime.Now%></td>
                </tr>
                <tr>
                    <td colspan="3" style="padding: 10px 0; border-top: 1px solid #000;">
                        <asp:Repeater ID="rptList" runat="server">
                            <HeaderTemplate>
                                <table width="100%" border="0" cellspacing="0" cellpadding="5" style="font-size: 12px; font-family: '微软雅黑'; background: #fff;">
                                    <tr>
                                        <td align="left" style="background: #ccc;">商品信息</th>
                                        <td width="12%" align="left" style="background: #ccc;">单价</td>
                                        <td width="10%" align="left" style="background: #ccc;">数量</td>
                                        <td width="12%" align="left" style="background: #ccc;">金额合计</td>
                                    </tr>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <tr>
                                    <td><%#getGoodsMsg(Eval("goodsNum").ToString())%></td>
                                    <td><%#Convert.ToDecimal(Eval("price"))%></td>
                                    <td><%#Convert.ToInt32(Eval("numbers"))%></td>
                                    <td><%#Convert.ToDecimal(Eval("totalMoney"))%></td>
                                </tr>
                            </ItemTemplate>
                            <FooterTemplate>
                                <%#rptList.Items.Count == 0 ? "<tr><td align=\"center\" colspan=\"7\">暂无记录</td></tr>" : ""%>
                        </table>
                            </FooterTemplate>
                        </asp:Repeater>
                    </td>
                </tr>
                <tr>
                    <td colspan="3" style="border-top: 1px solid #000;">
                        <table width="100%" border="0" cellspacing="0" cellpadding="5" style="margin: 5px auto; font-size: 12px; font-family: '微软雅黑'; background: #fff;">
                            <tr>
                                <td  width="40%">微信账户：
                                <%if (userModel != null)
                                  { %>
                                    <%=userModel.nickName%>
                                    <%}
                                  else
                                  { %>
                                  匿名用户
                                <%} %>
                                </td>
                                <td width="60%">支付方式：<%= (model.payWay==1?"微支付":"其它方式") %></td>
                            </tr>
                            <tr>
                                <td width="40%">姓名：<%= (model.addressText!=""?(model.addressText).Split(',')[0]:"") %></td>
                                <td width="60%">手机：<%= (model.addressText!=""?(model.addressText).Split(',')[1]:"") %></td>
                            </tr>
                            <tr>
                                <td>送货地址：<%= (model.addressText!=""?(model.addressText).Split(',')[2]:"") %><br />
                                </td>
                            </tr>
                        </table>
                        <table width="100%" border="0" align="center" cellpadding="5" cellspacing="0" style="border-top: 1px solid #000; font-size: 12px; font-family: '微软雅黑'; background: #fff;">
                            <tr>
                                <td align="right">订单总额：￥<%=model.totalMoney%></td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
    </form>
</body>
</html>
